// import axios from '../../utils/http';
import axios from 'axios';
export default {
<<<<<<< HEAD
    namespaced: true,
    state: {
        a: 1,
        c: [],
        b: [],
        d: '',
        product: [],
        table: [],
        tableAll: [],
        mode: [],
        queue: [],
        food: [],
        line: ''
=======
  namespaced: true,
  state: {
    a: 1,
    c: [],
    b: [],
    d: '',
    product: [],
    table: [],
    tableAll: [],
    mode: [],
    queue: [],
    food: [],
    line: ''
>>>>>>> 4c3059630cb1659c2b780d5d9e45c89416dc5c7c

  },
  actions: {
    line (a, value) {
      axios({
        url: "/xjh/product/line",
      }).then((res) => {
        a.commit('number', res.data.data.pop())
      }).catch((err) => {
        console.log(err, '错误')
      });
    },
<<<<<<< HEAD
    actions: {
        line(a, value) {
            axios({
                url: "/api/product/line",
            }).then((res) => {
                a.commit('number', res.data.data.pop())
            }).catch((err) => {
                console.log(err, '错误')
            });
        },
        queue(a, value) {
            console.log('成功', a, value)
            axios({
                url: "/api/numeralorder/queue",
            }).then((res) => {
                console.log(res.data.data)
                a.state.queue = res.data.data
            });
        },
        jia(a, value) {
            axios({
                url: "/api/coupon/api/manage/coupon",
            }).then((res) => {
                a.state.c = res.data.data
            });
        },
        jiaA(a, value) {

            axios({
                url: "/api/product/api/manage/Product",
            }).then((res) => {
                console.log(res)
                a.state.product = res.data.data
            }).catch((err) => {
                console.log(err)
            });
        },
        table(a, value) {

            axios({
                url: "/api/tablelist/gettablearea",
            }).then((res) => {
                a.state.table = res.data.data
            }).catch((err) => {
                console.log(err)
            });
        },
        tableAll(a, value) {
            console.log('成功运行1111', a, value)
            axios({
                url: "/api/tablelist/gettableAll",
            }).then((res) => {
                console.log(res)

                a.commit('change', res.data.data)
=======
    queue (a, value) {
      console.log('成功', a, value)
      axios({
        url: "/xjh/numeralorder/queue",
      }).then((res) => {
        console.log(res.data.data)
        a.state.queue = res.data.data
      });
    },
    jia (a, value) {
      axios({
        url: "/xjh/coupon/xjh/manage/coupon",
      }).then((res) => {
        a.state.c = res.data.data
      });
    },
    jiaA (a, value) {

      axios({
        url: "/xjh/product/xjh/manage/Product",
      }).then((res) => {
        console.log(res)
        a.state.product = res.data.data
      }).catch((err) => {
        console.log(err)
      });
    },
    table (a, value) {

      axios({
        url: "/xjh/tablelist/gettablearea",
      }).then((res) => {
        a.state.table = res.data.data
      }).catch((err) => {
        console.log(err)
      });
    },
    async tableAll (a, value) {
      // console.log('成功运行1111', a, value)
      await axios({
        url: "/xjh/tablelist/gettableAll",
      }).then((res) => {
>>>>>>> 4c3059630cb1659c2b780d5d9e45c89416dc5c7c

        a.commit('change', res.data.data)

<<<<<<< HEAD
            });
        },
        send(a, value) {
            // console.log('成功运行1111', a, value)
            axios({
                url: "/api/coupon/api/manage/coupon/apiange",
                params: value
            }).then(async (res) => {
                await a.dispatch('jia')
                a.state.d = res.data.msg
            }).catch((err) => {
                console.log(err)
            })
        },
        sendTwo(a, value) {
            console.log('成功运行1111', a, value)
            axios({
                url: "/api/product/sendTwo",
                params: value
            }).then(async (res) => {
                await a.dispatch('jiaA', 'over', 'food', 'line')
                a.state.d = res.data.msg
            }).catch((err) => {
                console.log(err)
            })
        },
        over(a, value) {
            axios({
                url: "/api/product/api/manage/Product/pro",
                params: value
            }).then(async (res) => {
                await a.dispatch('jiaA')
                a.state.d = res.data.msg
            }).catch((err) => {
                console.log(err)
            })
        },
        food(a, value) {
            axios({
                url: "/api/product/api/manage/Product/food",
                params: value
            }).then(async (res) => {
                console.log(22222);
                console.log(res.data.data)
                await a.dispatch('jiaA')
                a.state.food = res.data.data
            }).catch((err) => {
                console.log(err)
            })
        },
=======
      }).catch((err) => {

      });
    },
    send (a, value) {
      // console.log('成功运行1111', a, value)
      axios({
        url: "/xjh/coupon/xjh/manage/coupon/change",
        params: value
      }).then(async (res) => {
        await a.dispatch('jia')
        a.state.d = res.data.msg
      }).catch((err) => {
        console.log(err)
      })
    },
    sendTwo (a, value) {
      console.log('成功运行1111', a, value)
      axios({
        url: "/xjh/product/sendTwo",
        params: value
      }).then(async (res) => {
        await a.dispatch('jiaA', 'over', 'food', 'line')
        a.state.d = res.data.msg
      }).catch((err) => {
        console.log(err)
      })
    },
    over (a, value) {
      axios({
        url: "/xjh/product/xjh/manage/Product/pro",
        params: value
      }).then(async (res) => {
        await a.dispatch('jiaA')
        a.state.d = res.data.msg
      }).catch((err) => {
        console.log(err)
      })
    },
    food (a, value) {
      axios({
        url: "/xjh/product/xjh/manage/Product/food",
        params: value
      }).then(async (res) => {
        console.log(22222);
        console.log(res.data.data)
        await a.dispatch('jiaA')
        a.state.food = res.data.data
      }).catch((err) => {
        console.log(err)
      })
    },
>>>>>>> 4c3059630cb1659c2b780d5d9e45c89416dc5c7c

  },
  mutations: {
    change (state, n) {
      state.tableAll = []
      state.mode = []
      n.forEach((v) => {
        state.tableAll.push(v.table_num)
        state.mode.push(v.table_state)
      })
    },
<<<<<<< HEAD
    mutations: {
        change(state, n) {
            state.tableAll = [];
            state.mode = [];
            n.forEach((v) => {

                state.tableAll.push(v.table_num)
                state.mode.push(v.table_state)
            })
        },
        number(state, n) {
            if ((n.pack_rank) * 1 + 1 < 100) {
                state.line = '0' + ((n.pack_rank) * 1 + 1)
            } else {
                (n.line_num) * 1 + 1
            }
        }
=======
    number (state, n) {
      if ((n.pack_rank) * 1 + 1 < 100) {
        state.line = '0' + ((n.pack_rank) * 1 + 1)
      } else {
        (n.line_num) * 1 + 1
      }
>>>>>>> 4c3059630cb1659c2b780d5d9e45c89416dc5c7c
    }
  }

}